package com.coder.bike.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author 沈诩宸
 * @since 2025-04-22
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("bike_info")
@ApiModel(value = "BikeInfo对象", description = "")
public class BikeInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("单车id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("单车类型（1普通/2电动/3亲子/4其他)")
    private Byte typeId;

    @ApiModelProperty("其他类型类型名")
    private String specialType;

    @ApiModelProperty("物联网设备ID")
    private String iotDeviceId;

    @ApiModelProperty("颜色")
    private String color;

    @ApiModelProperty("实时位置")
    private byte[] gps;

    @ApiModelProperty("电量百分比（电动车型专用）")
    private Integer battery;

    @ApiModelProperty("累计骑行里程（km）")
    private Integer mileage;

    @ApiModelProperty("基础时租费")
    private BigDecimal hourlyFee;

    @ApiModelProperty("生产日期")
    private LocalDate manufactureDate;

    @ApiModelProperty("车身二维码URL")
    private String qrCode;

    @ApiModelProperty("状态（0闲置/1使用中/2维修中/3报废）")
    private Byte status;

    @ApiModelProperty("车锁状态（0解锁/1锁定）")
    private Boolean lockStatus;

    @ApiModelProperty("上次保养时间")
    private LocalDateTime lastMaintain;

    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ApiModelProperty("逻辑删除,0为未删除")
    private Byte deleted;

    @ApiModelProperty("单车昵称")
    private String nickname;

    @ApiModelProperty("单车编号,格式：CITY_CODE+序列号")
    private String bikeNum;

    @ApiModelProperty("所属厂商id")
    private Integer masterId;

    @ApiModelProperty("所属品牌id")
    private Integer brandId;

    // 添加以下字段
    @TableField(exist = false)
    private Integer lowMileage;

    @TableField(exist = false)
    private Integer highMileage;

    @TableField(exist = false)
    private LocalDate lowManufactureDate;

    @TableField(exist = false)
    private LocalDate highManufactureDate;

    // ============= 新增维修相关字段 =============
    @ApiModelProperty("累计维护次数")
    private Integer maintainCount;

    @ApiModelProperty("累计维护费用")
    private BigDecimal totalMaintainCost;

    @ApiModelProperty("预计维护周期(天)")
    private Integer expectedMaintainCycle;

    @ApiModelProperty("实际平均维护周期(天)")
    private Integer actualMaintainCycle;

    @ApiModelProperty("下次预计维护时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime nextMaintainTime;

    @ApiModelProperty("维护等级(1-常规 2-重要 3-紧急)")
    private Byte maintainLevel;

    // ============= 查询条件字段 =============
    @TableField(exist = false)
    private Integer lowMaintainCount;

    @TableField(exist = false)
    private Integer highMaintainCount;

    @TableField(exist = false)
    private BigDecimal lowMaintainCost;

    @TableField(exist = false)
    private BigDecimal highMaintainCost;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lowNextMaintainTime;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime highNextMaintainTime;

    @TableField(exist = false)
    private String makerName;

    @TableField(exist = false)
    private String brandName;
}
